]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Do not check for class cancellable state after awaiting
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 16 Feb 2026 21:11:28 +0000 (22:11 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 14 Mar 2026 17:31:56 +0000 (18:31 +0100)
In an async function, after awaiting, the cancelled state for the
class-tracked cancellable may not respect the actual state of the
cancellable that has been used to perform the call.

Thus, let's use a local variable instead

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4080>
(cherry picked from commit c55a07df6b498adb3c570d22f0024d16fc052b41)

js/ui/search.js

index ac5401566e22b094488deca7535dea6582925db6..1139cbfde5181992a2e34f3949ed170daa131391 100644 (file)
@@ -225,11 +225,12 @@ const SearchResultsBase = GObject.registerClass({
             return;
 
         this._cancellable.cancel();
-        this._cancellable = new Gio.Cancellable();
+        const cancellable = new Gio.Cancellable();
+        this._cancellable = cancellable;
 
-        const metas = await this.provider.getResultMetas(metasNeeded, this._cancellable);
+        const metas = await this.provider.getResultMetas(metasNeeded, cancellable);
 
-        if (this._cancellable.is_cancelled()) {
+        if (cancellable.is_cancelled()) {
             if (metas.length > 0)
                 throw new Error(`Search provider ${this.provider.id} returned results after the request was canceled`);
         }